import { createRouter, createWebHashHistory } from "vue-router";
import Index from '@/view/Index.vue';
import AddGood from '@/view/AddGood.vue';
import Login from '@/view/Login.vue';
import Swiper from '@/view/Swiper.vue';
import IndexConfig from '@/view/IndexConfig.vue';
import Category from '@/view/Category.vue'
import Good from '@/view/Good.vue'
import Order from '@/view/Order.vue'
import OrderDetail from '@/view/OrderDetail.vue'
import Guest from '@/view/Guest.vue'
import Account from '@/view/Account.vue'

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: '/',
      name: 'Index',
      component: Index,
      meta: { title: '首页' }
    },
    {
      path: '/addGood',
      name: 'AddGood',
      component: AddGood,
      meta: { title: '添加' }
    },
    {
      path: '/login',
      name: 'login',
      component: Login,
      meta: { showMenu: false }
    },
    {
      path: '/swiper',
      name: 'swiper',
      component: Swiper,
      meta: { title: '轮播图' }
    },
    {
      path: '/hot',
      name: 'hot',
      component: IndexConfig,
      meta: { title: '热销' }
    },
    {
      path: '/new',
      name: 'new',
      component: IndexConfig,
      meta: { title: '最新' }
    },
    {
      path: '/recommend',
      name: 'recommend',
      component: IndexConfig,
      meta: { title: '为你推荐' }
    },
    {
      path: '/category',
      name: 'category',
      component: Category,
      meta: { title: '分类' },
      children: [
        {
          path: '/category/level2',
          name: 'level2',
          component: Category,
        },
        {
          path: '/category/level3',
          name: 'level3',
          component: Category,
        }
      ]
    },
    {
      path: '/good',
      name: 'good',
      component: Good,
      meta: { title: '商品' }
    },
    {
      path: '/order',
      name: 'order',
      component: Order,
      meta: { title: '订单' }
    },
    {
      path: '/order_detail',
      name: 'order_detail',
      component: OrderDetail,
      meta: { title: '订单详情' }
    },
    {
      path: '/guest',
      name: 'guest',
      component: Guest,
      meta: { title: '会员' }
    },
    {
      path: '/account',
      name: 'account',
      component: Account,
      meta: { title: '账户' }
    }
  ]
})
export default router;